from api.base_api import BaseApi
from api.wework import WeWork


class Address(BaseApi):

    def __init__(self):
        secrete = 'WtKAsO_Du7-K8wpjbUj-KHbgVP3splxpPZDdZluMMjE'
        self.token = WeWork().get_token(secrete)

    def create(self, userid, name, mobile):
        data = {
            "method": "post",
            "url": 'https://qyapi.weixin.qq.com/cgi-bin/user/create',
            "params": {
                "access_token": self.token
            },
            "json": {
                "userid": userid,
                "name": name,
                "mobile": mobile,
                "department": [1]
            }
        }
        return self.session_send(data)
